package com.hua.designpattern.j2eepattern.frontcontroller;

public class FrontController {

	private Dispatcher dispatcher = new Dispatcher();

	private void addLog(String request) {
		System.out.println("--add log: " + request);
	}

	private boolean doValidation(String request) {
		System.out.println("--do validation: " + request);
		if (request == null) {
			System.out.println("****do validation: failed");
			return false;
		}
		return true;
	}

	public void dispatchRequest(String request) {
		addLog(request);
		if (doValidation(request)) {
			dispatcher.dispatch(request);
		}
	}
}
